Computer Configuration > Administrative Templates > Firefox > Clear data when browser is closed
Both
HKLM\Software\Policies\Mozilla\Firefox\SanitizeOnShutdown
If the policy is enabled, the cache is cleared when the browser is closed. If this policy is disabled or not configured, the cache is not cleared when the browser is closed.